<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 冒充继承  = 浅拷贝+ 寄生继承
        function Person(name,age){
            this.name = name;
            this.age = age;
        }

        Person.prototype.sayHello = function(){
            console.log('hello world');
        }


        // 实例化一个父类的对象 
        var p = new  Person('张三',18)
        // Object.assign(, p)

        function Student(gender){
            this.gender = gender;
            Object.assign(this, p)
        }


        Student.prototype = Person.prototype


        var s1 = new Student('男')
        console.log(s1);

    </script>
</body>
</html>